import API from '../../utils/api'
import common from '../../utils/common'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    datalist:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getManagementInfo(options.id)
  },
  onShow: function () {

  },
  getManagementInfo (id) {
    API.applyManagement({id:id}).then(res=>{
      console.log(res)
      if(res.code == 0) {
        var data = res.data
        for (var k in data) {
          data[k].isShow = false
          data[k]['pay_time'] = common.dateFormat(data[k].pay_time,2)
        }
        console.log(data)
        wx.setNavigationBarTitle({
          title: '报名('+data.length+')'
        })
        this.setData({
          datalist: data
        })
      }
    })
  },
  // 展开与搜索
  toggle (e) {
    var index = e.currentTarget.dataset.index
    var dataList = this.data.datalist
    dataList[index].isShow=!dataList[index].isShow
    this.setData({
      datalist:dataList
    })
  }

 
})